<template>
	<view>
		<web-view ref="myWebview" id="myWebview" :src="src" @message="messaged"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				src: null,
				mapData: {},
				reflectorId:null
			}
		},
		onLoad(option) {
			this.reflectorId=option.reflectorId
			uni.setNavigationBarTitle({
				title: "可视化演示",
			});
			this.src =`https://t3.web.xn--xhq521b/web?reflectorId=${this.reflectorId}&token=${this.$store.state.token}`;

		},
		methods: {
			messaged(e) {
				let par = e.target.data[0]
				if (par.action == 'sendData') {
					this.mapData = par.data
				}
			},
			onUnload() {
				if (this.mapData.cuttingGeom) {
					uni.$emit('mapEvent', this.mapData); // 触发自定义事件，并传递参数
				}
			},
		}
	}
</script>

<style>

</style>